package com.example.itcompanyinterview.tools;

import com.example.itcompanyinterview.FeedBackActivity;
import com.example.itcompanyinterview.R;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.MenuItem;

public class MenuHelper {
	private Context context;
	private MenuItem item;

	public MenuHelper(Context context, MenuItem item) {
		this.context = context;
		this.item = item;
	}

	public void processMenu() {
		switch (item.getItemId()) {
			case R.id.AboutApp:
				AboutDialog about = new AboutDialog(context);
				about.setTitle("关于");
				about.show();
				break;
			case R.id.feedback_menu:
				Intent intent = new Intent(context, FeedBackActivity.class);
				context.startActivity(intent);
				break;
			case R.id.nightMode:
				this.showNightModeEggs();
				break;
		}
	}
	
	private void showNightModeEggs() {
		AlertDialog alert = new AlertDialog.Builder(this.context).create();
    	alert.setTitle("夜间模式");
    	alert.setMessage("洗洗睡吧，大脑兴奋、休息不好、面试怎么会好?面试时间不是晚上，不需要训练这个时间的状态，安啦~~");
    	alert.setButton(DialogInterface.BUTTON_POSITIVE, "确认", 
    			new DialogInterface.OnClickListener() {
					@Override
					public void onClick(DialogInterface dialog, int which) {
						return;
					}
				}
    	);
    	alert.show();
	}
	
}
